package com.lvhx.springboot.springbatch.readfile;

import com.lvhx.springboot.entity.User;
import org.springframework.batch.item.ItemProcessor;

/**
 * @auther 吕宏旭
 * @date 2019/9/4 14:48
 */
public class FileProcessor implements ItemProcessor<User, User> {
    @Override
    public User process(User user) throws Exception {
        return needsToBeFiltered(user) ? null : user;
    }


    private boolean needsToBeFiltered(User user) {
        String name = user.getName();
        return name.equals("zhangsan") ? true : false;
    }
}
